package com.tmsps.ne4weixin.bean.menu;

import java.util.ArrayList;
import java.util.List;

import com.alibaba.fastjson2.annotation.JSONField;


public class ConditionMenu {

	/**
	 *  一级菜单最多三个
	 */
	@JSONField(name = "button")
	private List<MenuButton> menuButton = new ArrayList<MenuButton>();
	
	private Matchrule matchrule;
	
	public ConditionMenu(List<MenuButton> menuButton) {
		super();
		this.menuButton = menuButton;
	}
	
	public ConditionMenu(List<MenuButton> menuButton, com.tmsps.ne4weixin.bean.menu.Matchrule matchrule) {
		super();
		this.menuButton = menuButton;
		this.matchrule = matchrule;
	}

	public List<MenuButton> getMenuButton() {
		return menuButton;
	}

	public void setMenuButton(List<MenuButton> menuButton) {
		if (null == menuButton || menuButton.size() > 3) {
			throw new IllegalArgumentException("一级菜单最多只有3个");
		}
		this.menuButton = menuButton;
	}

	public void addMenuButton(MenuButton mb) {
		this.menuButton.add(mb);
		if (this.menuButton.size() > 3) {
			throw new IllegalArgumentException("一级菜单最多只有3个");
		}
	}

	public Matchrule getMatchrule() {
		return matchrule;
	}

	public void setMatchrule(Matchrule matchrule) {
		this.matchrule = matchrule;
	}
	
}
